package it.unisa.ingegneria.tdp.esercitazione5;

public class ClientGraph {

	public static void main(String[] args) {

		Graph<String> g=new Graph<String>();
		
		MyVertex<String> v1= g.insertVertex("a");
		MyVertex<String> v2= g.insertVertex("h");
		MyVertex<String> v3= g.insertVertex("b");
		MyVertex<String> v4= g.insertVertex("i");
		MyVertex<String> v5= g.insertVertex("g");
		MyVertex<String> v6= g.insertVertex("c");
		MyVertex<String> v7= g.insertVertex("f");
		MyVertex<String> v8= g.insertVertex("d");
		MyVertex<String> v9= g.insertVertex("e");
		
		g.insertEdge(v1, v2,7);  
		g.insertEdge(v1, v3,4);         
		g.insertEdge(v2, v3,11);    
		g.insertEdge(v2, v4,8);  
		g.insertEdge(v2, v5,1);
		g.insertEdge(v3, v6,8);
		g.insertEdge(v4, v6,2);
		g.insertEdge(v4, v5,6);
		g.insertEdge(v5, v7,2);  
		g.insertEdge(v6, v8,7);         
		g.insertEdge(v6, v7,4);    
		g.insertEdge(v7, v9,10);  
		g.insertEdge(v8, v7,14);
		g.insertEdge(v8, v9,1);
		
		//STAMPA GRAFO
		System.out.print("STAMPA DEL GRAFO\n");
		System.out.println(g.toString());
		
		//BFS
		System.out.print("BFS\n");
		BFS<String> b=new BFS<String>(g);
		b.breadthFirstSearch(v1);
		
		//KRUSKAL
		System.out.print("\nKRUSKAL\n");
		Kruskal<String> kruskal;
		Graph<String> mstKruskal;
		kruskal=new Kruskal<String>(g);
		mstKruskal=kruskal.creaAlberoDiConnessioneMinimo();
		System.out.println(mstKruskal.toString());
				
	}

}
